from google.appengine.ext import ndb

# id is 'demo'

class Heater(ndb.Model):
    dev_online = ndb.IntegerProperty(default=0) # long(datetime.datetime.now().strftime("%Y%m%d%H%M%S"))
    web_online = ndb.IntegerProperty(default=0)
    global_dirty = ndb.BooleanProperty(default=False) # clean global_dirty before check sub dirty

    temp = ndb.StringProperty(default='0')
    humi = ndb.StringProperty(default='0')

    desired = ndb.StringProperty(default='0') # return 'keep' or value
    desired_dirty = ndb.BooleanProperty(default=False)

    wifi_list = ndb.StringProperty(default='[]')
    wifi_connected = ndb.StringProperty(default='')

    wifi_set_ssid = ndb.StringProperty(default='')
    wifi_set_passwd = ndb.StringProperty(default='')
    wifi_set_dirty = ndb.BooleanProperty(default=False) # share one dirty

    dev_name = ndb.StringProperty(default='(none)')
    dev_name_dirty = ndb.BooleanProperty(default=False)

    date = ndb.StringProperty(default='2001-05-18 05:18')
    date_dirty = ndb.BooleanProperty(default=False)

    timer = ndb.StringProperty(default='[]')
    timer_dirty = ndb.BooleanProperty(default=False)

    calibrate = ndb.StringProperty(default='0')
    calibrate_dirty = ndb.BooleanProperty(default=False)

    restart_dirty = ndb.BooleanProperty(default=False) # no value

    power = ndb.StringProperty(default='off')
    power_dirty = ndb.BooleanProperty(default=False)
